// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   TrTag.java

package com.vandagroup.common.taglib.html;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.struts.util.ResponseUtils;

public class TrTag extends TagSupport
{

    protected String type;
    protected String rowType;
    protected String styleClass;
    protected String style;
    protected String height;
    protected String bgColor;
    protected String onClick;
    protected String id;
    public static String JiOu = "Ji";

    public TrTag()
    {
        type = null;
        rowType = null;
        styleClass = null;
        style = null;
        height = null;
        bgColor = null;
        onClick = null;
        id = null;
    }

    public String getHeight()
    {
        return height;
    }

    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public String getRowType()
    {
        return rowType;
    }

    public String getStyle()
    {
        return style;
    }

    public String getStyleClass()
    {
        return styleClass;
    }

    public String getType()
    {
        return type;
    }

    public void setHeight(String height)
    {
        this.height = height;
    }

    public void setRowType(String rowType)
    {
        this.rowType = rowType;
    }

    public void setStyle(String style)
    {
        this.style = style;
    }

    public void setStyleClass(String styleClass)
    {
        this.styleClass = styleClass;
    }

    public void setType(String type)
    {
        this.type = type;
    }

    public String getBgColor()
    {
        return bgColor;
    }

    public void setBgColor(String bgColor)
    {
        this.bgColor = bgColor;
    }

    public String getOnClick()
    {
        return onClick;
    }

    public void setOnClick(String onClick)
    {
        this.onClick = onClick;
    }

    public int doStartTag()
        throws JspException
    {
        StringBuffer sb = new StringBuffer("<tr ");
        if(type == null)
        {
            sb.append(height == null ? "" : " height=\"" + height + "\"");
            sb.append(styleClass == null ? "" : " class=\"" + styleClass + "\"");
            sb.append(style == null ? "" : " style=\"" + style + "\"");
            sb.append(bgColor == null ? "" : " bordercolor=\"" + bgColor + "\"");
        } else
        if(type.toUpperCase().equals("LIST"))
        {
            String sty = "";
            if(rowType != null)
                if(rowType.toUpperCase().equals("TITLE"))
                    sty = "Title";
                else
                if(rowType.toUpperCase().equals("OU") || rowType.toUpperCase().equals("JI"))
                {
                    if(JiOu.equals("Ji"))
                        JiOu = "Ou";
                    else
                        JiOu = "Ji";
                    sty = JiOu;
                }
            sb.append(" class=ListTr" + sty);
            sb.append(style == null ? "" : " style=\"" + style + "\"");
        } else
        if(type.toUpperCase().equals("INPUT"))
        {
            String sty = "";
            if(rowType != null)
                if(rowType.toUpperCase().equals("TITLE"))
                    sty = "Title";
                else
                if(rowType.toUpperCase().equals("OU") || rowType.toUpperCase().equals("JI"))
                {
                    if(JiOu.equals("Ji"))
                        JiOu = "Ou";
                    else
                        JiOu = "Ji";
                    sty = JiOu;
                }
            sb.append(" class=ListTr" + sty);
        } else
        if(type.toUpperCase().equals("BUTTON"))
        {
            sb.append(" class=ButtonTr" + (rowType != null && rowType.toUpperCase().equals("JI") ? "Ji" : "") + (rowType != null && rowType.toUpperCase().equals("OU") ? "Ou" : ""));
            sb.append(style == null ? "" : " style=\"" + style + "\"");
        } else
        if(type.toUpperCase().equals("SEARCH"))
        {
            sb.append(" class=SearchTr" + (rowType != null && rowType.toUpperCase().equals("JI") ? "Ji" : "") + (rowType != null && rowType.toUpperCase().equals("OU") ? "Ou" : ""));
            sb.append(style == null ? "" : " style=\"" + style + "\"");
        } else
        if(type.toUpperCase().equals("MEMO"))
        {
            sb.append(" class=MemoTr" + (rowType != null && rowType.toUpperCase().equals("JI") ? "Ji" : "") + (rowType != null && rowType.toUpperCase().equals("OU") ? "Ou" : ""));
            sb.append(style == null ? "" : " style=\"" + style + "\"");
        } else
        {
            sb.append("");
        }
        sb.append(onClick == null ? "" : " onclick=\"" + onClick + "\"");
        sb.append(rowType != null && !rowType.toUpperCase().equals("TITLE") ? " onmousedown=\"_clickTr( this )\" style=\"cursor: hand\"" : "");
        sb.append(id == null ? "" : " id=\"" + id + "\"");
        sb.append(">");
        ResponseUtils.write(pageContext, sb.toString());
        return 1;
    }

    public int doEndTag()
        throws JspException
    {
        ResponseUtils.write(pageContext, "</tr>");
        if(type != null && !type.toUpperCase().equals("LIST") && !type.toUpperCase().equals("INPUT") && !type.toUpperCase().equals("BUTTON") && !type.toUpperCase().equals("SEARCH"))
            type.toUpperCase().equals("MEMO");
        return 6;
    }

}
